﻿using System;

namespace UniRx.InternalUtil
{
	// Token: 0x02000217 RID: 535
	internal class ScheduledItem : IComparable<ScheduledItem>
	{
		// Token: 0x06000C9D RID: 3229 RVA: 0x0003DFA8 File Offset: 0x0003C3A8
		public ScheduledItem(Action action, TimeSpan dueTime)
		{
			this._dueTime = dueTime;
			this._action = action;
		}

		// Token: 0x170000F1 RID: 241
		// (get) Token: 0x06000C9E RID: 3230 RVA: 0x0003DFC9 File Offset: 0x0003C3C9
		public TimeSpan DueTime
		{
			get
			{
				return this._dueTime;
			}
		}

		// Token: 0x06000C9F RID: 3231 RVA: 0x0003DFD1 File Offset: 0x0003C3D1
		public void Invoke()
		{
			if (!this._disposable.IsDisposed)
			{
				this._action();
			}
		}

		// Token: 0x06000CA0 RID: 3232 RVA: 0x0003DFF0 File Offset: 0x0003C3F0
		public int CompareTo(ScheduledItem other)
		{
			if (object.ReferenceEquals(other, null))
			{
				return 1;
			}
			return this.DueTime.CompareTo(other.DueTime);
		}

		// Token: 0x06000CA1 RID: 3233 RVA: 0x0003E01F File Offset: 0x0003C41F
		public static bool operator <(ScheduledItem left, ScheduledItem right)
		{
			return left.CompareTo(right) < 0;
		}

		// Token: 0x06000CA2 RID: 3234 RVA: 0x0003E02B File Offset: 0x0003C42B
		public static bool operator <=(ScheduledItem left, ScheduledItem right)
		{
			return left.CompareTo(right) <= 0;
		}

		// Token: 0x06000CA3 RID: 3235 RVA: 0x0003E03A File Offset: 0x0003C43A
		public static bool operator >(ScheduledItem left, ScheduledItem right)
		{
			return left.CompareTo(right) > 0;
		}

		// Token: 0x06000CA4 RID: 3236 RVA: 0x0003E046 File Offset: 0x0003C446
		public static bool operator >=(ScheduledItem left, ScheduledItem right)
		{
			return left.CompareTo(right) >= 0;
		}

		// Token: 0x06000CA5 RID: 3237 RVA: 0x0003E055 File Offset: 0x0003C455
		public static bool operator ==(ScheduledItem left, ScheduledItem right)
		{
			return object.ReferenceEquals(left, right);
		}

		// Token: 0x06000CA6 RID: 3238 RVA: 0x0003E05E File Offset: 0x0003C45E
		public static bool operator !=(ScheduledItem left, ScheduledItem right)
		{
			return !(left == right);
		}

		// Token: 0x06000CA7 RID: 3239 RVA: 0x0003E06A File Offset: 0x0003C46A
		public override bool Equals(object obj)
		{
			return object.ReferenceEquals(this, obj);
		}

		// Token: 0x06000CA8 RID: 3240 RVA: 0x0003E073 File Offset: 0x0003C473
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		// Token: 0x170000F2 RID: 242
		// (get) Token: 0x06000CA9 RID: 3241 RVA: 0x0003E07B File Offset: 0x0003C47B
		public IDisposable Cancellation
		{
			get
			{
				return this._disposable;
			}
		}

		// Token: 0x170000F3 RID: 243
		// (get) Token: 0x06000CAA RID: 3242 RVA: 0x0003E083 File Offset: 0x0003C483
		public bool IsCanceled
		{
			get
			{
				return this._disposable.IsDisposed;
			}
		}

		// Token: 0x04000734 RID: 1844
		private readonly BooleanDisposable _disposable = new BooleanDisposable();

		// Token: 0x04000735 RID: 1845
		private readonly TimeSpan _dueTime;

		// Token: 0x04000736 RID: 1846
		private readonly Action _action;
	}
}
